﻿using System;
using System.Windows.Threading;
using Red.Controls.Shell;
using Red.EngineData.Protocol.Interop;

namespace Red.Controls.Utils
{
    public class ViewUpdateUIThreadScheduler : IViewUpdateScheduler
    {
        public void Schedule( ViewUpdateEventHandler handler )
        {
            if ( RedApplication.Current != null )
            {
                RedApplication.Current.Dispatcher.Invoke( DispatcherPriority.Background, new Action(
                () =>
                {
                    handler();
                } ) );
            }
        }
    }
}
